package com.example.chenz.intentandbroacast;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.view.View.OnClickListener;

public class MainActivity extends AppCompatActivity {

    private Button button =null;
    private final String nobody="who.care.the.name";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button = (Button)findViewById(R.id.button);

        button.setOnClickListener(new MyButtonListener());
    }

    class MyButtonListener implements OnClickListener{
        @Override
        public void onClick(View view){
            Intent intent = new Intent(nobody);
            intent.putExtra("testIntent","123456");
            sendBroadcast(intent);
        }
    }
}
